package edu.its.dreamteam.web.components;

import org.apache.tapestry.MarkupWriter;
import org.apache.tapestry.annotations.Parameter;
import org.apache.tapestry.ioc.annotations.Inject;

import edu.its.dreamteam.daf.beans.Club;
import edu.its.dreamteam.daf.beans.Player;
import edu.its.dreamteam.daf.dao.IClubDao;
import edu.its.dreamteam.daf.dao.IPlayerDao;

public class OutputPlayer {
	@Parameter
    private String idPlayer;
	@Inject
	private IPlayerDao playerDao;
	@Inject
	private IClubDao clubDao;
	
	public IPlayerDao getPlayerDao() {
		return playerDao;
	}
	
	public IClubDao getClubDao() {
		return clubDao;
	}

	void beginRender(MarkupWriter writer)
    {
		Player player = (Player) getPlayerDao().findByPrimaryKey(idPlayer);
		Club club = (Club)getClubDao().findByPrimaryKey(player.getIdClub());
        writer.write(player.getFirstName()+" "+player.getLastName());
    }
}
